package gui.filefilter;

import java.io.File;
/*

    This file is part of Logica-Logike.

    Logica-Logike is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation version 3 of the License.

    Logica-Logike is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Logica-Logike.  If not, see <http://www.gnu.org/licenses/>.

 */
/**
 * @author Jose Martin Rozanec;
 */
public class TXTFileFilter extends AbstractFileFilter {

    /**
     * Aceptar todos los directorios y archivos .txt;
     *
     * @param file;
     * @return boolean acepta;
     */
    public boolean accept(File file) {
        if (file.isDirectory()) {
            return true;
        }

        String extension = getExtension(file);
        if (extension != null) {
            if (extension.equals("txt")) {
                return true;
            } else {
                return false;
            }
        }

        return false;
    }

    /**
     * descripcion del filtro;
     *
     * @return String descripcion;
     */
    public String getDescription() {
        return ".txt";
    }
}
